﻿using System;

namespace HeerCards
{

    /// <summary>
    /// 一个卡等级域
    /// </summary>
    public class HCLevel
    {
        /// <summary>
        /// 占比的分子
        ///分母为所有HCPool中HCLevel总和加起来的数
        ///例如两个HCLevel，分别为100，200则几率为1/3
        /// </summary>
        internal string GUID { get; set; }
        public int Ratio { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        internal int min;
        internal int max;

        /// <summary>
        /// 默认实例化
        /// </summary>
        /// <param name="Ratio">占比位</param>
        public HCLevel(int Ratio)
        {
            this.Ratio = Ratio;
            this.GUID = Guid.NewGuid().ToString();
        }

    }
    /// <summary>
    /// 一张卡
    /// </summary>
    public class HCCard : IHCCard
    {
        /// <summary>
        /// 卡片的等级
        /// </summary>
        public HCLevel Level { get; set; }

        /// <summary>
        /// 卡片的名字
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// 额外几率
        /// </summary>
        public int ExtraProbability { get; set; }

        /// <summary>
        /// 图片存放相对路径
        /// </summary>
        public string LocalImagePath { get; set; }

        public HCCard(HCLevel level, string name)
        {
            this.Level = level;
            this.Name = name;
            this.ExtraProbability = 1;

        }
        internal HCCard(vHCCard hCCard)
        {
            this.Level = hCCard.Level;
            this.Name = hCCard.Name;
            this.Description = hCCard.Description;
            this.LocalImagePath = hCCard.LocalImagePath;
        }
    }

    public interface IHCCard
    {
        /// <summary>
        /// 卡片的等级
        /// </summary>
        HCLevel Level { get; set; }

        /// <summary>
        /// 卡片的名字
        /// </summary>
        string Name { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        string Description { get; set; }



        /// <summary>
        /// 图片存放相对路径
        /// </summary>
        string LocalImagePath { get; set; }
    }

    internal class vHCCard : IHCCard
    {
        public HCLevel Level { get; set; }
        public string Name { get; set; }
        public string Description { get; set; }
        public string LocalImagePath { get; set; }
        public vHCCard(HCCard hCCard)
        {
            this.Level = hCCard.Level;
            this.Name = hCCard.Name;
            this.Description = hCCard.Description;
            this.LocalImagePath = hCCard.LocalImagePath;
        }
        public HCCard ConvertToHCCard()
        {
            return new HCCard(this);
        }
    }

}
